<template>
  <aside class="article_aside">
    <!--菜单列表-->
    <div class="list card">
      <el-menu
          :default-active="defaultActive"
          class="el-menu-vertical-demo"
          background-color="#fff"
          text-color="#999"
          :collapse="false"
          :collapse-transition="false"
          active-text-color="#369BFF"
      >
        <!--一级菜单-->
        <el-submenu
            :index="firstItem.class_name"
            v-for="firstItem in menuList"
            :key="firstItem.id"
        >
          <template slot="title">
            <i :class="iconsObj[firstItem.id]"></i>
            <span>{{ firstItem.class_name }}</span>
          </template>
          <!--二级菜单-->
          <el-menu-item
              v-for="secendItem in firstItem.articles"
              :key="secendItem.id"
              :index="secendItem.id.toString()"
              @click="handleSaveheaderState(secendItem.id)"
          >
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>{{ secendItem.title }}</span>
            </template>
          </el-menu-item>
        </el-submenu>
      </el-menu>
    </div>
    <!--轮播图 -->
    <div class="swiper card">
      <div class="swiper_container">
        <el-carousel indicator-position="none">
          <el-carousel-item v-for="item in swiperArr" :key="item.imgsrc">
            <a target="blank" :href="item.url">
              <el-image fit="cover" style="height: 100px" :src="item.imgsrc"></el-image>
            </a>
            <div class="swiper_tip">
              <div class="tip_line">-Using-</div>
              <div class="tip_txt">{{ item.lable }}</div>
            </div>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>
  </aside>

</template>

<script>
export default {
  name: "Aside",
  props: ['swiperArr', 'menuList','iconsObj'],
  data() {
    return {
      defaultActive: "基础|笔记",
      isCollapse: false, //是否折叠菜单

    }
  },
  methods: {
    //打开菜单
    handleOpenCollapse(e) {
      console.log(e);
      this.isCollapse = !this.isCollapse;
    },
  }
}
</script>

<style lang="less" scoped>
aside.article_aside {
  margin-left: 10px;
  width: 300px;

  .list {
    margin-top: 10px;
    padding: 0;

    .el-menu {
      width: 100%;
      overflow: hidden;
    }
  }

  .swiper {
    margin-top: 10px;

    .swiper_container {
      width: 100%;

      .el-carousel {
        height: 300px;
        background-color: #fff;
      }
      .el-image{
        width: 100%;
      }
      .swiper_tip {
        display: flex;
        flex-direction: column;
        align-items: center;
      }

      .tip_line {
        margin-top: 10px;
      }

      .tip_txt {
        padding: 0 20px;
        height: 150px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
      }
    }
  }
}
@media screen and (max-width: 1000px){
  .swiper{
    display: none;
  }
}
</style>